/**
 * @FileName: InvokerInvocationHandler.java
 * @Package: com.ziroom.sms.std.rpc
 * @author liusq23
 * @created 2017/6/15 上午9:53
 * <p>
 * Copyright 2015 ziroom
 */
package com.ziroom.sms.std.rpc;

import com.ziroom.sms.std.netty.NettyClientRpcHandler;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.UUID;

/**
 * <p></p>
 *
 * <PRE>
 * <BR>	修改记录
 * <BR>-----------------------------------------------
 * <BR>	修改日期			修改人			修改内容
 * </PRE>
 *
 * @author liusq23
 * @since 1.0
 * @version 1.0
 */
public class InvokerInvocationHandler<T> implements InvocationHandler {

    private NettyClientRpcHandler rpcHandler;

    public InvokerInvocationHandler (NettyClientRpcHandler rpcHandler) {
        this.rpcHandler = rpcHandler;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        SmsdboInvocation invocation = new SmsdboInvocation();
        invocation.setParameters(args);
        invocation.setParameterTypes(method.getParameterTypes());
        invocation.setMethodName(method.getName());
        invocation.setInterfaceName(proxy.getClass().getName());
        invocation.setToken(UUID.randomUUID().toString());
//        Object result = rpcHandler.sendRpcInvoke(invocation);
        return null;
    }
}
